home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / c / objam01.lha / objam / test / objbasTest.m < prev    next >
Encoding:
Text File  |  1994-12-04  |  757 b   |  36 lines

  1. #include <stdio.h>
  2. #include <objc/objc.h>
  3. #include <objbas/IdArray.h>
  4. #include <objbas/String.h>
  5.  
  6.  
  7. void testarray(void)
  8. {
  9.   id myArray;
  10.   int i;
  11.  
  12.   if(myArray=[IdArray with:3, [String str:"Testing:"], [String str:"- foo"], [String str:"- bar"]])
  13.   {
  14.     for(i=0;i<[myArray capacity];i++) printf("%d: %s\n",i,[[myArray at:i] str]);
  15.     [myArray storeOn:"ram:myArray.nib"];
  16.     [myArray freeContents];
  17.     [myArray free];
  18.   }
  19.   else puts("Error creating IdArray object.");
  20.  
  21.   if(myArray=[IdArray readFrom:"ram:myArray.nib"])
  22.   {
  23.     for(i=0;i<[myArray capacity];i++) printf("%d: %s\n",i,[[myArray at:i] str]);
  24.     [myArray freeContents];
  25.     [myArray free];
  26.   }
  27.   else puts("Error reading ram:myArray.nib.");
  28. }
  29.  
  30.  
  31. int main(void)
  32. {
  33.   testarray();
  34.   return 0;
  35. }
  36.